<template>
	<view class="refund-add-express-pop">
		<u-popup :show="show_pop" round="32" mode="center" @close="show_pop = false" @open=" show_pop = true">
			<view class="express-poup">
				<view class="express-title">
					输入邮寄信息
				</view>
				<view class="company-item">
					<view class="label">快递公司</view>
					<view class="input-box">
						<input v-model="params.kuaidiCompany" placeholder="请输入您邮寄商品的快递公司" class="input-p"/>
					</view>
				</view>
				<view class="company-item">
					<view class="label">快递单号</view>
					<view class="input-box">
						<input v-model="params.kuaidiOrderId" placeholder="请输入您邮寄商品的快递单号" class="input-p"/>
					</view>
				</view>
				<view class="btn-box">
					<view class="btn" @click="show_pop = false">
						取消
					</view>
					<view class="btn" @click="doSubmit()">
						确认
					</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show_pop: false,
				params: {
					id: '',
					kuaidiCompany: '',
					kuaidiOrderId: ''
				}
			};
		},
		methods: {
			init(item) {
				console.log('售后数据', item)
				this.params.id = item.id;
				this.show_pop = true;
			},
			onclose() {
				this.show_pop = false;
			},
			doSubmit() {
				if (!this.params.kuaidiCompany) {
					this.$alert('快递公司不能为空')
					return false;
				}
				if (!this.params.kuaidiOrderId) {
					this.$alert('快递单号不能为空')
					return false;
				}

				this.$api({
					url: '/service.php',
					method: 'get',
					data: {
						action: 'refund_addKuaidi',
						...this.params
					},
				}).then(res => {
					this.$alert(res)
					if (res.code == 200) {
						this.show_pop = false
						this.$emit('confirm')
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.express-poup {
		padding: 52rpx 24rpx 64rpx;
		width: 686rpx;
		background: #FFFFFF;
		border-radius: 32rpx 32rpx 32rpx 32rpx;

		.express-title {
			text-align: center;
			margin-bottom: 30rpx;
			
			font-family: PingFang SC, PingFang SC;
			font-weight: bold;
			font-size: 32rpx;
			color: #000000;
		}

		.company-item {
			margin-bottom: 30rpx;
			// display: flex;
			// align-items: center;
			// height: 80rpx;
			// line-height: 80rpx;

			.label {
				font-family: PingFang SC, PingFang SC;
				font-weight: bold;
				font-size: 24rpx;
				color: #000000;
			}

			.input-box {
				margin-top: 12rpx;

				input {
					width: 638rpx;
					height: 64rpx;
					background: #F8F8F8;
					border-radius: 8rpx 8rpx 8rpx 8rpx;
				}
				.input-p {
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					font-size: 24rpx;
					color: #9695A3;
				}
			}
		}

		.btn-box {
			margin-top: 60rpx;
			display: flex;
			justify-content: space-between;

			.btn {
				width: 306rpx;
				height: 80rpx;
				line-height: 80rpx;
				text-align: center;
				border-radius: 64rpx 64rpx 64rpx 64rpx;

				&:nth-child(1) {
					background: #F8F8F8;
				}

				&:nth-child(2) {
					background: #CB0011;
					font-size: 28rpx;
					color: #FFFFFF;
				}
			}
		}
	}
</style>